{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>adm_index</title>
    <link rel="stylesheet" href="{% static 'css/sqlTable.css' %}">
    <link rel="stylesheet" href="{% static 'css/navbar.css' %}">
    <link rel="stylesheet" href="{% static 'css/pagination.css' %}">
    <link rel="stylesheet" href="{% static 'css/search.css' %}">
    <script type="text/javascript" src="{% static 'js/click.js' %}"></script>
</head>
<body>
<body background="{% static 'img/adm.jpg' %}" style="background-repeat:no-repeat ;background-size:100% 100%;background-attachment: fixed;">
    {% load static %}
    <!-- 导航栏 -->
    <div class="navbar">
        <div class="system-name">图书馆图书借阅系统——系统首页</div>
        <nav class="menu">
            <a href="/adm_index" class="menu-item">系统首页</a>
            <a href="/adm_book" class="menu-item">查看图书</a>
            <a href="/adm_borrow" class="menu-item">借阅记录</a>
            <a href="/adm_stuInfo" class="menu-item">学生信息</a>
            <a href="/adm_info" class="menu-item">个人中心</a>
        </nav>
        <div class="user-info">
            <span class="username">欢迎您，管理员：{{ admdd.adm_id }}</span>
            <a href="/login">
                <button class="button">退出</button>
            </a>
        </div>
    </div>
    <div class= "container">
        <table>
            <thead>
                <tr>
                    <th>公告序号</th>
                    <th>标题</th>
                    <th>发布日期</th>
                    <th>发布者</th>
                    <th>选项</th>
                    <th>操作</th>
                </tr>
            </thead>
            <tbody>
                {% for nt in notice %}
                <tr>
                    <td>{{ nt.notice_id }}</td>
                    <td>{{ nt.notice_title }}</td>
                    <td>{{ nt.notice_date }}</td>
                    <td>{{ nt.admId_id }}</td>
                    <form method="post" action="/noticeContent/">
                        {% csrf_token %}
                        <input type="hidden" name="form_id" value="check">
                        <input type="hidden" name="user_id" value="{{ admdd.adm_id }}">
                        <input type="hidden" name="notice_id" value="{{ nt.notice_id }}">
                        <td class="action-column">
                            <input type="submit" value="查看" class="tablebutton">
                        </td>
                    </form>
                    <form method="post" action="">
                        {% csrf_token %}
                        <input type="hidden" name="form_id" value="delete">
                        <input type="hidden" name="user_id" value="{{ admdd.adm_id }}">
                        <input type="hidden" name="notice_id" value="{{ nt.notice_id }}">
                        <td class="action-column">
                            <input type="submit" value="删除" class="tablebutton">
                        </td>
                    </form>

                </tr>
                {% endfor %}
            </tbody>
        </table>
        <div class="pagination">
            <form method="get" action=".">
                {% csrf_token %}
                {% if notice.has_previous %}
                    <button type="submit" name="page" value="1">&laquo; 第一页</button>
                    <button type="submit" name="page" value="{{ notice.previous_page_number }}">上一页</button>
                {% endif %}

                <span class="current">
                    页码 {{ notice.number }} / {{ notice.paginator.num_pages }}
                </span>

                {% if notice.has_next %}
                    <button type="submit" name="page" value="{{ notice.next_page_number }}">下一页</button>
                    <button type="submit" name="page" value="{{ notice.paginator.num_pages }}">最后一页 &raquo;</button>
                {% endif %}
                </form>
        </div>
    </div>
    <p>
         <a href="/noticeAddAlter" class="belowButton">添加公告</a>
    </p>
</body>

</html>